home *** CD-ROM | disk | FTP | other *** search
- Path: gwen.pcug.co.uk!altheim!broldham
- Newsgroups: comp.lang.c
- Message-ID: <1242@altheim.win-uk.net>
- References: <1239@altheim.win-uk.net><18MAR199607594276@erich.triumf.ca>
- Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
- From: broldham@altheim.win-uk.net (Brian R. Oldham)
- Date: Tue, 19 Mar 1996 08:50:30 GMT
- Subject: Re: Pointers to register
-
-
- In article <18MAR199607594276@erich.triumf.ca>, P.Bennett (bennett@erich.triumf.ca) writes:
- >In article <1239@altheim.win-uk.net>, broldham@altheim.win-uk.net (Brian R. Oldham) writes...
- [snip]
- >>
- >>Bearing in mind the usual way to assign a pointer:
- >>
- >> ptr = &var;
- >>
- >>is correct for objects in memory, but how do you assign a pointer
- >>to a register?
- >
- >You don't - a register doesn't have a memory address.
- >
- >>The following function works: But is it right??
- >
- >>static union REGS inregs, outregs;
- >
- >>void getkey(int *scancode, char *ch)
- >>{
- >> inregs.h.ah = 0x00;
- >> int86(KEYBD,&inregs,&outregs);
- >> *scancode = outregs.h.ah; /* ??? */
- >
- >This is not referencing a register - outregs is a union the compiler provides
- >to allow the user to provide the values used to set the registers before
- >calling int86(), or to store the return values from that function.
- >
-
- OK Point taken. But it still leaves the question why my compiler
- (B.Turbo C/C++ v3.0) accepts the above code, but complains at:
-
- scancode = &outregs.h.ah;
-
-
-
- ---
- Brian Oldham
- Hucknall UK
- !...Gesundbrunnen
-
-
-
-
-
-
-
-
-